<style>
@media print {
  ._wz_certificateCriterionFormSee {
    -webkit-print-color-adjust: exact;
    height: inherit !important;
    font-size: 12px !important;
  }
}
</style>
<template>
  <div class="_wz_certificateCriterionFormSee" ref="certificateCriterionFormSee">

    <table cellpadding="0" cellspacing="0" border="0">
      <colgroup>
        <col width="13%">
        <col width="20%">
        <col width="13%">
        <col width="20%">
      </colgroup>
      <tbody>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="4">
          标准化证书
          <Button type="primary" @click="printTest" class="no-print" style="position: absolute;right: 10px;top: 8px;">
            打印
          </Button>
        </td>
      </tr>
      <tr>
        <td colspan="2" rowspan="4">
          <div class="demo-upload-list">
            <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
              <img v-if="formData.certificateState == 3" :src="!!contractImgFile.url?contractImgFile.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
              <img v-else :src="!!uniformSocialCreditImgFile.url?uniformSocialCreditImgFile.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
            </viewer>
          </div>
        </td>
        <td style="text-align: right;font-weight: 600;">证书编号</td>
        <td>{{!!formData.certificateNo ? formData.certificateNo : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">证书类别</td>
        <td>{{!!formData.certificateType ? formData.certificateType : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">证书状态</td>
        <td>
          <template v-if="formData.certificateState == 1">已生效</template>
          <template v-else-if="formData.certificateState == 2">已逾期</template>
          <template v-else-if="formData.certificateState == 3">办理中</template>
          <template v-else>--</template>
        </td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">达标等级</td>
        <td>
          <template v-if="formData.certificateLevel == 1">一级</template>
          <template v-else-if="formData.certificateLevel == 2">二级</template>
          <template v-else-if="formData.certificateLevel == 3">三级</template>
          <template v-else>--</template>
        </td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">经营类型</td>
        <td>{{!!formData.certificateMold ? formData.certificateMold : '--'}}</td>
        <td style="text-align: right;font-weight: 600;">评定机构</td>
        <td>{{!!formData.certificateIssueName ? formData.certificateIssueName : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">发证日期</td>
        <td>{{!!formData.certificateReleaseDate ? formData.certificateReleaseDate : '--'}}</td>
        <td style="text-align: right;font-weight: 600;">截止日期</td>
        <td>{{!!formData.certificateDueDate ? formData.certificateDueDate : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">运输企业</td>
        <td colspan="3">{{!!formData.deptName ? formData.deptName : '--'}}</td>
      </tr>
      </tbody>
    </table>
    <Spin size="large" fix v-if="spinShow"></Spin>

  </div>
</template>
<script>
export default {
  props: ["selectData", 'formType'],
  data() {
    return {
      uploadProgress: 0,//文件上传进度
      item: {},
      spinShow: false,//本页加载
      //下级企业列表
      subDeptList: [],
      //从业类型
      personType: [],
      //从业人员头像
      uniformSocialCreditImgFile: {
        data: null,
        url: ''
      },
      contractImgFile: {
        data: null,
        url: ''
      },
      formData: {},
    }
  },
  beforeCreate() {//beforeCreate创建前状态

  },
  created() {//created创建完毕状态

  },
  beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

  },
  mounted() {//mounted 挂载结束状态
    let that = this;
    that.formData = JSON.parse(JSON.stringify(that.selectData));
    that.uniformSocialCreditImgFile.url = !!that.selectData.certificateImg ? that.apiUrl.imgUrl + that.selectData.certificateImg : '';
    that.contractImgFile.url = !!that.selectData.contractImg ? that.apiUrl.imgUrl + that.selectData.contractImg : '';
    //运输企业
    that.axios.post(that.apiUrl.coreDeptCoreDeptList, {}).then(res => {
      if (!!res) {
        that.subDeptList = res.data.data;
      }
    }).catch(err => {
      console.log("失败", err)
    })

  },
  methods: {//执行的方法
    printTest() {
      this.$print(this.$refs.certificateCriterionFormSee) // 使用
    },
  },
  watch: {//监听

  },
  beforeUpdate() {//beforeUpdate 更新前状态

  },
  updated() {//updated 更新完成状态

  },
  beforeDestroy() {//beforeDestroy 销毁前状态

  },
  destroyed() {//destroyed 销毁完成状态

  }
}
</script>
<style lang="less">
._wz_certificateCriterionFormSee {

  >table {
    table-layout:fixed;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 12px !important;

    td {
      min-width: 0;
      height: 40px;
      box-sizing: border-box;
      text-align: left;
      text-overflow: ellipsis;
      border: 1px solid #515a6e;
      padding: 0 10px;
      word-break: break-word;
    }
  }

  .demo-upload-list {
    margin: 5px auto;
    width: 195px;
    height: 140px;
    text-align: center;
    line-height: 140px;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    position: relative;
    box-shadow: 0 0 0 0;

    img {
      min-height: 30%;
      max-height: 90%;
      min-width: 30%;
      max-width: 90%;
      //width: 100%;
      //height: 100%;
    }
  }


}
</style>
